use batters

gen before=0
replace before=1 if season==2012

gen after=0
replace after=1 if season==2013

gen inter=after*treatment

gen age=season-birth
gen age2=age*age

gen fa_m1=0
replace fa_m1=1 if season==begin-1

gen fa_m2=0
replace fa_m2=1 if season==begin-2

gen fa_m3=0
replace fa_m3=1 if season==begin-3

gen fa_p1=0
replace fa_p1=1 if season==begin

gen fa_p2=0
replace fa_p2=1 if season==begin+1

gen fa_p3=0
replace fa_p3=1 if season==begin+2

gen fa_p3_above=0
replace fa_p3_above=1 if season>=begin+2

gen fa_p4_above=0
replace fa_p4_above=1 if season>=begin+3

gen fa_p5_above=0
replace fa_p5_above=1 if season>=begin+4

replace ops=ops/1000

gen size=money/duration
gen logsize=log(size)

xtset id season

drop if id==18 | id==29 | id==32
drop if begin<2011

sum ab ops age size fa_m1 treatment
sum ab ops age size fa_m1 treatment if season==2012
sum ab ops age size fa_m1 treatment if season==2013


xtreg ab inter after fa_m1, fe
xtreg ops inter after fa_m1, fe
xtreg ab inter treatment after fa_m1 age age2 logsize, re
xtreg ops inter treatment after fa_m1 age age2 logsize, re
